//
//  LcCellData.h
//  18Birdies
//
//  Created by Lc on 15/4/2.
//  Copyright (c) 2015年 Lc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "UIButton+Lc.h"

@class LcCellData;

typedef void (^OnCellClickedHanlder)(__kindof LcCellData* cellData);
typedef void (^ValueChangeHandler)(__kindof LcCellData* cellData);

@class LcCell;
@class LcCellAdapter;

@interface LcCellData : NSObject

@property(nonatomic, strong) NSMutableDictionary* userInfo;
@property(nonatomic, weak) LcCellAdapter* cellAdapter;
@property(nonatomic, strong) OnCellClickedHanlder onCellClickedHandler;
@property(nonatomic, copy) NSString* group;

// hidden can be set to YES only if canHide is YES
@property(nonatomic, assign) BOOL canHide;
@property(nonatomic, assign) BOOL hidden;
@property(nonatomic, weak) LcCellData* lastMemberCellData;

#pragma mark - can override
// default is replace "CellData" to "Cell"
// while self.className include "CellData"
- (Class)cellClazz;
// default NO
- (BOOL)singleton;
// nil for not use nib, default is cellClazz
- (NSString*)nibName;
// need call super
- (void)refreshCell:(__kindof LcCell*)cell;

- (void)willDisplayCell:(__kindof LcCell*)cell;
// removed from the table view;
- (void)didDismissCell:(__kindof LcCell*)cell;

// default NO
@property(nonatomic, assign) BOOL clickable;
// default NO
@property(nonatomic, assign) BOOL userInteractionDisabled;

// default 0, means fully opaque, 1 means fully transparent
@property(nonatomic, assign) CGFloat transparency;

// default NO
@property(nonatomic, assign) BOOL canEdit;

#pragma mark - never override
- (NSString*)reuseId;
- (id)newCell;
@property(nonatomic, assign) CGFloat cellHeight;
- (void)setNeedRefreshCellHeight;

- (CGFloat)peekCellHeight;

// internal, NEVER use it
- (void)postRefreshCell:(LcCell*)cell;

- (id)objectForKeyedSubscript:(id)key;
- (void)setObject:(id)object forKeyedSubscript:(id<NSCopying>)key;

@end
